package org.doubango.FrCall.Screens;

import org.doubango.FrCall.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class NumberRegister extends Activity {
	private Button nToCheck;
	private Button numRegBackToSelect;
	private EditText Etnum;//输入注册的手机号码
	String number;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.register_number);
		nToCheck = (Button) findViewById(R.id.n_to_check);
		numRegBackToSelect = (Button) findViewById(R.id.num_reg_back_select);
		Etnum=(EditText) findViewById(R.id.number);
		
		nToCheck.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if(validate()){
				Intent intent = new Intent(NumberRegister.this,NumberRegisterCheck.class);
				number=Etnum.getText().toString();
				intent.putExtra("number",number);
				startActivity(intent);
				finish();
				}
			}
		});
		
		numRegBackToSelect.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(NumberRegister.this,RegisterSelect.class);
				startActivity(intent);
				finish();
			}
		});
	}
    private boolean validate(){
    	number=Etnum.getText().toString();
 		if(number.equals("")){
 			Toast.makeText(this, "号码不能为空！", Toast.LENGTH_SHORT).show();
 			return false;
 		}
    	return true;
    }
    
}
